package org.car.world.service.impl;

import java.util.List;

import org.car.world.core.entily.VouchersTable;
import org.car.world.core.mapper.VouchersTableMapper;
import org.car.world.service.VouchersService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import com.github.pagehelper.PageHelper;

@Service
@Transactional(rollbackFor = {RuntimeException.class, Exception.class})
public class VouchersServiceImpl implements VouchersService {

    @Autowired
    VouchersTableMapper vouchersTableMapper;

    @Override
    public int insert(VouchersTable record) {
        return vouchersTableMapper.insert(record);
    }

    @Override
    public List<VouchersTable> selectAll() {
        return vouchersTableMapper.selectAll();
    }

    @Override
    public int deleteByPrimaryKey(Integer vouchersId) {
        return vouchersTableMapper.deleteByPrimaryKey(vouchersId);
    }

    @Override
    public VouchersTable selectByPrimaryKey(Integer vouchersId) {
        return vouchersTableMapper.selectByPrimaryKey(vouchersId);
    }

    @Override
    public int updateByPrimaryKey(VouchersTable record) {
        return vouchersTableMapper.updateByPrimaryKey(record);
    }

    @Override
    public List<VouchersTable> selectLimit(Integer form, Integer size) {
        PageHelper.startPage(form, size);
        return vouchersTableMapper.selectAll();
    }

    @Override
    public int selectcount() {
        // TODO Auto-generated method stub
        return 0;
    }

    @Override
    public int selectCountByUser(Integer userId) {
        return vouchersTableMapper.selectCountByUser(userId);
    }

    @Override
    public List<VouchersTable> selectByUser(Integer userId) {
        return vouchersTableMapper.selectByUser(userId);
    }

    @Override
    public List<VouchersTable> selectByVouchersIdList(Integer vouchersId, Integer merchantsId) {
        return vouchersTableMapper.selectByVouchersIdList(vouchersId, merchantsId);
    }

}
